package cn.edu.cqut.mapper;

import cn.edu.cqut.entity.Contact;
import cn.edu.cqut.util.PageResult;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author HQYJ
 * @since 2020-06-24
 */
public interface ContactMapper extends BaseMapper<Contact> {
	@Select("select * from contact where cus_no=#{cusNo}")
	List<Contact> selectContactByCusNo(Integer cusNo);
	
	//${ew.customSqlSegment} 是固定的
	@Select("SELECT contact.*,customer.cus_name from contact,customer ${ew.customSqlSegment} ")
	//@Param(Constants.WRAPPER)条件查询
	Page<Contact> selectContactWithCustomer(Page<Contact> page, @Param(Constants.WRAPPER) QueryWrapper<Contact> qw);
}//在mapper里面加Page进行分页
